<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>libnetFAQ - libnet Frequently Asked Questions - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/Net::libnetFAQ">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Net::libnetFAQ.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/Net::libnetFAQ">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/Net::libnetFAQ">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/Net::libnetFAQ">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/Net::libnetFAQ">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/Net::libnetFAQ">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/Net::libnetFAQ">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/Net::libnetFAQ">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/Net::libnetFAQ">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/Net::libnetFAQ">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/Net::libnetFAQ">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/Net::libnetFAQ">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/Net::libnetFAQ">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/Net::libnetFAQ">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/Net::libnetFAQ">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/Net::libnetFAQ">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/Net::libnetFAQ">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/Net::libnetFAQ">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/Net::libnetFAQ">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/Net::libnetFAQ">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/Net::libnetFAQ">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/Net::libnetFAQ">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/Net::libnetFAQ">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/Net::libnetFAQ">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/Net::libnetFAQ">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/Net::libnetFAQ">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/Net::libnetFAQ">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/Net::libnetFAQ">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/Net::libnetFAQ">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/Net::libnetFAQ">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/Net::libnetFAQ">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/Net::libnetFAQ">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/Net::libnetFAQ">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/Net::libnetFAQ">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/Net::libnetFAQ">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/Net::libnetFAQ">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/Net::libnetFAQ">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/Net::libnetFAQ">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/Net::libnetFAQ">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/Net::libnetFAQ">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/Net::libnetFAQ">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/Net::libnetFAQ">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/Net::libnetFAQ">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/Net::libnetFAQ">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/Net::libnetFAQ">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/Net::libnetFAQ">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/Net::libnetFAQ">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/Net::libnetFAQ">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/Net::libnetFAQ">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/Net::libnetFAQ">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/Net::libnetFAQ">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/Net::libnetFAQ">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/Net::libnetFAQ">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/Net::libnetFAQ">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/Net::libnetFAQ">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/Net::libnetFAQ">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/Net::libnetFAQ">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/Net::libnetFAQ">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/Net::libnetFAQ">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/Net::libnetFAQ">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/Net::libnetFAQ">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/Net::libnetFAQ">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/Net::libnetFAQ">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/Net::libnetFAQ">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/Net::libnetFAQ">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/Net::libnetFAQ">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/Net::libnetFAQ">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/Net::libnetFAQ">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/Net::libnetFAQ">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/Net::libnetFAQ">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/Net::libnetFAQ">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/Net::libnetFAQ">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/Net::libnetFAQ">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/Net::libnetFAQ">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/Net::libnetFAQ">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/Net::libnetFAQ">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/Net::libnetFAQ">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/Net::libnetFAQ">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/Net::libnetFAQ">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/Net::libnetFAQ">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/Net::libnetFAQ">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Net::libnetFAQ.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/Net::libnetFAQ">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/Net::libnetFAQ">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/Net::libnetFAQ">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/Net::libnetFAQ">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/Net::libnetFAQ">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/Net::libnetFAQ">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/Net::libnetFAQ">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/Net::libnetFAQ">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/Net::libnetFAQ">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/Net::libnetFAQ">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/Net::libnetFAQ">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/Net::libnetFAQ">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/Net::libnetFAQ">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/Net::libnetFAQ">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/Net::libnetFAQ">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/Net::libnetFAQ">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/Net::libnetFAQ">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/Net::libnetFAQ">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/Net::libnetFAQ">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/Net::libnetFAQ">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/Net::libnetFAQ">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/Net::libnetFAQ">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/Net::libnetFAQ">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/Net::libnetFAQ">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/Net::libnetFAQ">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/Net::libnetFAQ">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/Net::libnetFAQ">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/Net::libnetFAQ">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/Net::libnetFAQ">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/Net::libnetFAQ">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/Net::libnetFAQ">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/Net::libnetFAQ">5.35.1</a>
          <a class="dropdown-item active" href="./Net::libnetFAQ.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Net::libnetFAQ.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./Net::libnetFAQ.html">Net::libnetFAQ</a>
          <div id="more">
            (<a href="./Net::libnetFAQ.txt">source</a>,
            <a href="https://metacpan.org/pod/Net::libnetFAQ">CPAN</a>)
          </div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#DESCRIPTION">DESCRIPTION</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Where-to-get-this-document">Where to get this document</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#How-to-contribute-to-this-document">How to contribute to this document</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Author-and-Copyright-Information">Author and Copyright Information</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Disclaimer">Disclaimer</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Obtaining-and-installing-libnet">Obtaining and installing libnet</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#What-is-libnet-?">What is libnet ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Which-version-of-perl-do-I-need-?">Which version of perl do I need ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#What-other-modules-do-I-need-?">What other modules do I need ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#What-machines-support-libnet-?">What machines support libnet ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Where-can-I-get-the-latest-libnet-release">Where can I get the latest libnet release</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Using-Net::FTP">Using Net::FTP</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#How-do-I-download-files-from-an-FTP-server-?">How do I download files from an FTP server ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#How-do-I-transfer-files-in-binary-mode-?">How do I transfer files in binary mode ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#How-can-I-get-the-size-of-a-file-on-a-remote-FTP-server-?">How can I get the size of a file on a remote FTP server ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#How-can-I-get-the-modification-time-of-a-file-on-a-remote-FTP-server-?">How can I get the modification time of a file on a remote FTP server ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#How-can-I-change-the-permissions-of-a-file-on-a-remote-server-?">How can I change the permissions of a file on a remote server ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Can-I-do-a-reget-operation-like-the-ftp-command-?">Can I do a reget operation like the ftp command ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#How-do-I-get-a-directory-listing-from-an-FTP-server-?">How do I get a directory listing from an FTP server ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Changing-directory-to-%22%22-does-not-fail-?">Changing directory to &quot;&quot; does not fail ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#I-am-behind-a-SOCKS-firewall,-but-the-Firewall-option-does-not-work-?">I am behind a SOCKS firewall, but the Firewall option does not work ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#I-am-behind-an-FTP-proxy-firewall,-but-cannot-access-machines-outside-?">I am behind an FTP proxy firewall, but cannot access machines outside ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#My-ftp-proxy-firewall-does-not-listen-on-port-21">My ftp proxy firewall does not listen on port 21</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Is-it-possible-to-change-the-file-permissions-of-a-file-on-an-FTP-server-?">Is it possible to change the file permissions of a file on an FTP server ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#I-have-seen-scripts-call-a-method-message,-but-cannot-find-it-documented-?">I have seen scripts call a method message, but cannot find it documented ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Why-does-Net::FTP-not-implement-mput-and-mget-methods">Why does Net::FTP not implement mput and mget methods</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Using-Net::SMTP">Using Net::SMTP</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Why-can&#39;t-the-part-of-an-Email-address-after-the-@-be-used-as-the-hostname-?">Why can&#39;t the part of an Email address after the @ be used as the hostname ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Why-does-Net::SMTP-not-do-DNS-MX-lookups-?">Why does Net::SMTP not do DNS MX lookups ?</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#The-verify-method-always-returns-true-?">The verify method always returns true ?</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#Debugging-scripts">Debugging scripts</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#How-can-I-debug-my-scripts-that-use-Net::*-modules-?">How can I debug my scripts that use Net::* modules ?</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Net::libnetFAQ.html#AUTHOR-AND-COPYRIGHT">AUTHOR AND COPYRIGHT</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./Net::libnetFAQ.html#NAME">#</a>NAME</h1>

<p>libnetFAQ - libnet Frequently Asked Questions</p>

<h1 id="DESCRIPTION"><a class="permalink" href="./Net::libnetFAQ.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<h2 id="Where-to-get-this-document"><a class="permalink" href="./Net::libnetFAQ.html#Where-to-get-this-document">#</a><a id="Where"></a>Where to get this document</h2>

<p>This document is distributed with the libnet distribution, and is also available on the libnet web page at</p>

<p><a href="https://metacpan.org/release/libnet">https://metacpan.org/release/libnet</a></p>

<h2 id="How-to-contribute-to-this-document"><a class="permalink" href="./Net::libnetFAQ.html#How-to-contribute-to-this-document">#</a><a id="How"></a>How to contribute to this document</h2>

<p>You may report corrections, additions, and suggestions on the CPAN Request Tracker at</p>

<p><a href="https://rt.cpan.org/Public/Bug/Report.html?Queue=libnet">https://rt.cpan.org/Public/Bug/Report.html?Queue=libnet</a></p>

<h1 id="Author-and-Copyright-Information"><a class="permalink" href="./Net::libnetFAQ.html#Author-and-Copyright-Information">#</a><a id="Author"></a>Author and Copyright Information</h1>

<p>Copyright (C) 1997-1998 Graham Barr. All rights reserved. This document is free; you can redistribute it and/or modify it under the same terms as Perl itself, i.e. under the terms of either the GNU General Public License or the Artistic License, as specified in the <i>LICENCE</i> file.</p>

<p>Steve Hay &lt;<a href="mailto:shay@cpan.org">shay@cpan.org</a>&gt; is now maintaining libnet as of version 1.22_02.</p>

<h2 id="Disclaimer"><a class="permalink" href="./Net::libnetFAQ.html#Disclaimer">#</a>Disclaimer</h2>

<p>This information is offered in good faith and in the hope that it may be of use, but is not guaranteed to be correct, up to date, or suitable for any particular purpose whatsoever. The authors accept no liability in respect of this information or its use.</p>

<h1 id="Obtaining-and-installing-libnet"><a class="permalink" href="./Net::libnetFAQ.html#Obtaining-and-installing-libnet">#</a><a id="Obtaining"></a>Obtaining and installing libnet</h1>

<h2 id="What-is-libnet-?"><a class="permalink" href="./Net::libnetFAQ.html#What-is-libnet-?">#</a><a id="What"></a><a id="What-is-libnet"></a>What is libnet ?</h2>

<p>libnet is a collection of perl5 modules which all related to network programming. The majority of the modules available provided the client side of popular server-client protocols that are used in the internet community.</p>

<h2 id="Which-version-of-perl-do-I-need-?"><a class="permalink" href="./Net::libnetFAQ.html#Which-version-of-perl-do-I-need-?">#</a><a id="Which"></a><a id="Which-version-of-perl-do-I-need"></a>Which version of perl do I need ?</h2>

<p>This version of libnet requires Perl 5.8.1 or higher.</p>

<h2 id="What-other-modules-do-I-need-?"><a class="permalink" href="./Net::libnetFAQ.html#What-other-modules-do-I-need-?">#</a><a id="What1"></a><a id="What-other-modules-do-I-need"></a>What other modules do I need ?</h2>

<p>No non-core modules are required for normal use, except on os390, which requires Convert::EBCDIC.</p>

<p>Authen::SASL is required for AUTH support.</p>

<p>IO::Socket::SSL version 2.007 or higher is required for SSL support.</p>

<p>IO::Socket::IP version 0.25 or IO::Socket::INET6 version 2.62 is required for IPv6 support.</p>

<h2 id="What-machines-support-libnet-?"><a class="permalink" href="./Net::libnetFAQ.html#What-machines-support-libnet-?">#</a><a id="What2"></a><a id="What-machines-support-libnet"></a>What machines support libnet ?</h2>

<p>libnet itself is an entirely perl-code distribution so it should work on any machine that perl runs on.</p>

<h2 id="Where-can-I-get-the-latest-libnet-release"><a class="permalink" href="./Net::libnetFAQ.html#Where-can-I-get-the-latest-libnet-release">#</a><a id="Where1"></a>Where can I get the latest libnet release</h2>

<p>The latest libnet release is always on CPAN, you will find it in</p>

<p><a href="https://metacpan.org/release/libnet">https://metacpan.org/release/libnet</a></p>

<h1 id="Using-Net::FTP"><a class="permalink" href="./Net::libnetFAQ.html#Using-Net::FTP">#</a><a id="Using"></a>Using Net::FTP</h1>

<h2 id="How-do-I-download-files-from-an-FTP-server-?"><a class="permalink" href="./Net::libnetFAQ.html#How-do-I-download-files-from-an-FTP-server-?">#</a><a id="How1"></a><a id="How-do-I-download-files-from-an-FTP-server"></a>How do I download files from an FTP server ?</h2>

<p>An example taken from an article posted to comp.lang.perl.misc</p>

<pre><code>#!/your/path/to/perl

# a module making life easier

use Net::FTP;

# for debugging: $ftp = Net::FTP-&gt;new(&#39;site&#39;,&#39;Debug&#39;,10);
# open a connection and log in!

$ftp = Net::FTP-&gt;new(&#39;target_site.somewhere.xxx&#39;);
$ftp-&gt;login(&#39;username&#39;,&#39;password&#39;);

# set transfer mode to binary

$ftp-&gt;binary();

# change the directory on the ftp site

$ftp-&gt;cwd(&#39;/some/path/to/somewhere/&#39;);

foreach $name (&#39;file1&#39;, &#39;file2&#39;, &#39;file3&#39;) {

# get&#39;s arguments are in the following order:
# ftp server&#39;s filename
# filename to save the transfer to on the local machine
# can be simply used as get($name) if you want the same name

  $ftp-&gt;get($name,$name);
}

# ftp done!

$ftp-&gt;quit;</code></pre>

<h2 id="How-do-I-transfer-files-in-binary-mode-?"><a class="permalink" href="./Net::libnetFAQ.html#How-do-I-transfer-files-in-binary-mode-?">#</a><a id="How2"></a><a id="How-do-I-transfer-files-in-binary-mode"></a>How do I transfer files in binary mode ?</h2>

<p>To transfer files without &lt;LF&gt;&lt;CR&gt; translation Net::FTP provides the <code>binary</code> method</p>

<pre><code>$ftp-&gt;binary;</code></pre>

<h2 id="How-can-I-get-the-size-of-a-file-on-a-remote-FTP-server-?"><a class="permalink" href="./Net::libnetFAQ.html#How-can-I-get-the-size-of-a-file-on-a-remote-FTP-server-?">#</a><a id="How3"></a><a id="How-can-I-get-the-size-of-a-file-on-a-remote-FTP-server"></a>How can I get the size of a file on a remote FTP server ?</h2>

<h2 id="How-can-I-get-the-modification-time-of-a-file-on-a-remote-FTP-server-?"><a class="permalink" href="./Net::libnetFAQ.html#How-can-I-get-the-modification-time-of-a-file-on-a-remote-FTP-server-?">#</a><a id="How4"></a><a id="How-can-I-get-the-modification-time-of-a-file-on-a-remote-FTP-server"></a>How can I get the modification time of a file on a remote FTP server ?</h2>

<h2 id="How-can-I-change-the-permissions-of-a-file-on-a-remote-server-?"><a class="permalink" href="./Net::libnetFAQ.html#How-can-I-change-the-permissions-of-a-file-on-a-remote-server-?">#</a><a id="How5"></a><a id="How-can-I-change-the-permissions-of-a-file-on-a-remote-server"></a>How can I change the permissions of a file on a remote server ?</h2>

<p>The FTP protocol does not have a command for changing the permissions of a file on the remote server. But some ftp servers may allow a chmod command to be issued via a SITE command, eg</p>

<pre><code>$ftp-&gt;quot(&#39;site chmod 0777&#39;,$filename);</code></pre>

<p>But this is not guaranteed to work.</p>

<h2 id="Can-I-do-a-reget-operation-like-the-ftp-command-?"><a class="permalink" href="./Net::libnetFAQ.html#Can-I-do-a-reget-operation-like-the-ftp-command-?">#</a><a id="Can"></a><a id="Can-I-do-a-reget-operation-like-the-ftp-command"></a>Can I do a reget operation like the ftp command ?</h2>

<h2 id="How-do-I-get-a-directory-listing-from-an-FTP-server-?"><a class="permalink" href="./Net::libnetFAQ.html#How-do-I-get-a-directory-listing-from-an-FTP-server-?">#</a><a id="How6"></a><a id="How-do-I-get-a-directory-listing-from-an-FTP-server"></a>How do I get a directory listing from an FTP server ?</h2>

<h2 id="Changing-directory-to-&quot;&quot;-does-not-fail-?"><a class="permalink" href="./Net::libnetFAQ.html#Changing-directory-to-%22%22-does-not-fail-?">#</a><a id="Changing"></a><a id="Changing-directory-to-does-not-fail"></a>Changing directory to &quot;&quot; does not fail ?</h2>

<p>Passing an argument of &quot;&quot; to -&gt;cwd() has the same affect of calling -&gt;cwd() without any arguments. Turn on Debug (<i>See below</i>) and you will see what is happening</p>

<pre><code>$ftp = Net::FTP-&gt;new($host, Debug =&gt; 1);
$ftp-&gt;login;
$ftp-&gt;cwd(&quot;&quot;);</code></pre>

<p>gives</p>

<pre><code class="plaintext">Net::FTP=GLOB(0x82196d8)&gt;&gt;&gt; CWD /
Net::FTP=GLOB(0x82196d8)&lt;&lt;&lt; 250 CWD command successful.</code></pre>

<h2 id="I-am-behind-a-SOCKS-firewall,-but-the-Firewall-option-does-not-work-?"><a class="permalink" href="./Net::libnetFAQ.html#I-am-behind-a-SOCKS-firewall,-but-the-Firewall-option-does-not-work-?">#</a><a id="I"></a><a id="I-am-behind-a-SOCKS-firewall-but-the-Firewall-option-does-not-work"></a>I am behind a SOCKS firewall, but the Firewall option does not work ?</h2>

<p>The Firewall option is only for support of one type of firewall. The type supported is an ftp proxy.</p>

<p>To use Net::FTP, or any other module in the libnet distribution, through a SOCKS firewall you must create a socks-ified perl executable by compiling perl with the socks library.</p>

<h2 id="I-am-behind-an-FTP-proxy-firewall,-but-cannot-access-machines-outside-?"><a class="permalink" href="./Net::libnetFAQ.html#I-am-behind-an-FTP-proxy-firewall,-but-cannot-access-machines-outside-?">#</a><a id="I1"></a><a id="I-am-behind-an-FTP-proxy-firewall-but-cannot-access-machines-outside"></a>I am behind an FTP proxy firewall, but cannot access machines outside ?</h2>

<p>Net::FTP implements the most popular ftp proxy firewall approach. The scheme implemented is that where you log in to the firewall with <code>user@hostname</code></p>

<p>I have heard of one other type of firewall which requires a login to the firewall with an account, then a second login with <code>user@hostname</code>. You can still use Net::FTP to traverse these firewalls, but a more manual approach must be taken, eg</p>

<pre><code>$ftp = Net::FTP-&gt;new($firewall) or die $@;
$ftp-&gt;login($firewall_user, $firewall_passwd) or die $ftp-&gt;message;
$ftp-&gt;login($ext_user . &#39;@&#39; . $ext_host, $ext_passwd) or die $ftp-&gt;message.</code></pre>

<h2 id="My-ftp-proxy-firewall-does-not-listen-on-port-21"><a class="permalink" href="./Net::libnetFAQ.html#My-ftp-proxy-firewall-does-not-listen-on-port-21">#</a><a id="My"></a>My ftp proxy firewall does not listen on port 21</h2>

<p>FTP servers usually listen on the same port number, port 21, as any other FTP server. But there is no reason why this has to be the case.</p>

<p>If you pass a port number to Net::FTP then it assumes this is the port number of the final destination. By default Net::FTP will always try to connect to the firewall on port 21.</p>

<p>Net::FTP uses IO::Socket to open the connection and IO::Socket allows the port number to be specified as part of the hostname. So this problem can be resolved by either passing a Firewall option like <code>&quot;hostname:1234&quot;</code> or by setting the <code>ftp_firewall</code> option in Net::Config to be a string in the same form.</p>

<h2 id="Is-it-possible-to-change-the-file-permissions-of-a-file-on-an-FTP-server-?"><a class="permalink" href="./Net::libnetFAQ.html#Is-it-possible-to-change-the-file-permissions-of-a-file-on-an-FTP-server-?">#</a><a id="Is"></a><a id="Is-it-possible-to-change-the-file-permissions-of-a-file-on-an-FTP-server"></a>Is it possible to change the file permissions of a file on an FTP server ?</h2>

<p>The answer to this is &quot;maybe&quot;. The FTP protocol does not specify a command to change file permissions on a remote host. However many servers do allow you to run the chmod command via the <code>SITE</code> command. This can be done with</p>

<pre><code>$ftp-&gt;site(&#39;chmod&#39;,&#39;0775&#39;,$file);</code></pre>

<h2 id="I-have-seen-scripts-call-a-method-message,-but-cannot-find-it-documented-?"><a class="permalink" href="./Net::libnetFAQ.html#I-have-seen-scripts-call-a-method-message,-but-cannot-find-it-documented-?">#</a><a id="I2"></a><a id="I-have-seen-scripts-call-a-method-message-but-cannot-find-it-documented"></a>I have seen scripts call a method message, but cannot find it documented ?</h2>

<p>Net::FTP, like several other packages in libnet, inherits from Net::Cmd, so all the methods described in Net::Cmd are also available on Net::FTP objects.</p>

<h2 id="Why-does-Net::FTP-not-implement-mput-and-mget-methods"><a class="permalink" href="./Net::libnetFAQ.html#Why-does-Net::FTP-not-implement-mput-and-mget-methods">#</a><a id="Why"></a>Why does Net::FTP not implement mput and mget methods</h2>

<p>The quick answer is because they are easy to implement yourself. The long answer is that to write these in such a way that multiple platforms are supported correctly would just require too much code. Below are some examples how you can implement these yourself.</p>

<p>sub mput { my($ftp,$pattern) = @_; foreach my $file (glob($pattern)) { $ftp-&gt;put($file) or warn $ftp-&gt;message; } }</p>

<p>sub mget { my($ftp,$pattern) = @_; foreach my $file ($ftp-&gt;ls($pattern)) { $ftp-&gt;get($file) or warn $ftp-&gt;message; } }</p>

<h1 id="Using-Net::SMTP"><a class="permalink" href="./Net::libnetFAQ.html#Using-Net::SMTP">#</a><a id="Using1"></a>Using Net::SMTP</h1>

<h2 id="Why-can&#39;t-the-part-of-an-Email-address-after-the-@-be-used-as-the-hostname-?"><a class="permalink" href="./Net::libnetFAQ.html#Why-can&#39;t-the-part-of-an-Email-address-after-the-@-be-used-as-the-hostname-?">#</a><a id="Why1"></a><a id="Why-cant-the-part-of-an-Email-address-after-the-be-used-as-the-hostname"></a>Why can&#39;t the part of an Email address after the @ be used as the hostname ?</h2>

<p>The part of an Email address which follows the @ is not necessarily a hostname, it is a mail domain. To find the name of a host to connect for a mail domain you need to do a DNS MX lookup</p>

<h2 id="Why-does-Net::SMTP-not-do-DNS-MX-lookups-?"><a class="permalink" href="./Net::libnetFAQ.html#Why-does-Net::SMTP-not-do-DNS-MX-lookups-?">#</a><a id="Why2"></a><a id="Why-does-Net::SMTP-not-do-DNS-MX-lookups"></a>Why does Net::SMTP not do DNS MX lookups ?</h2>

<p>Net::SMTP implements the SMTP protocol. The DNS MX lookup is not part of this protocol.</p>

<h2 id="The-verify-method-always-returns-true-?"><a class="permalink" href="./Net::libnetFAQ.html#The-verify-method-always-returns-true-?">#</a><a id="The"></a><a id="The-verify-method-always-returns-true"></a>The verify method always returns true ?</h2>

<p>Well it may seem that way, but it does not. The verify method returns true if the command succeeded. If you pass verify an address which the server would normally have to forward to another machine, the command will succeed with something like</p>

<pre><code>252 Couldn&#39;t verify &lt;someone@there&gt; but will attempt delivery anyway</code></pre>

<p>This command will fail only if you pass it an address in a domain the server directly delivers for, and that address does not exist.</p>

<h1 id="Debugging-scripts"><a class="permalink" href="./Net::libnetFAQ.html#Debugging-scripts">#</a><a id="Debugging"></a>Debugging scripts</h1>

<h2 id="How-can-I-debug-my-scripts-that-use-Net::*-modules-?"><a class="permalink" href="./Net::libnetFAQ.html#How-can-I-debug-my-scripts-that-use-Net::*-modules-?">#</a><a id="How7"></a><a id="How-can-I-debug-my-scripts-that-use-Net::-modules"></a>How can I debug my scripts that use Net::* modules ?</h2>

<p>Most of the libnet client classes allow options to be passed to the constructor, in most cases one option is called <code>Debug</code>. Passing this option with a non-zero value will turn on a protocol trace, which will be sent to STDERR. This trace can be useful to see what commands are being sent to the remote server and what responses are being received back.</p>

<pre><code>#!/your/path/to/perl

use Net::FTP;

my $ftp = new Net::FTP($host, Debug =&gt; 1);
$ftp-&gt;login(&#39;gbarr&#39;,&#39;password&#39;);
$ftp-&gt;quit;</code></pre>

<p>this script would output something like</p>

<pre><code class="plaintext">Net::FTP: Net::FTP(2.22)
Net::FTP:   Exporter
Net::FTP:   Net::Cmd(2.0801)
Net::FTP:   IO::Socket::INET
Net::FTP:     IO::Socket(1.1603)
Net::FTP:       IO::Handle(1.1504)

Net::FTP=GLOB(0x8152974)&lt;&lt;&lt; 220 imagine FTP server (Version wu-2.4(5) Tue Jul 29 11:17:18 CDT 1997) ready.
Net::FTP=GLOB(0x8152974)&gt;&gt;&gt; user gbarr
Net::FTP=GLOB(0x8152974)&lt;&lt;&lt; 331 Password required for gbarr.
Net::FTP=GLOB(0x8152974)&gt;&gt;&gt; PASS ....
Net::FTP=GLOB(0x8152974)&lt;&lt;&lt; 230 User gbarr logged in.  Access restrictions apply.
Net::FTP=GLOB(0x8152974)&gt;&gt;&gt; QUIT
Net::FTP=GLOB(0x8152974)&lt;&lt;&lt; 221 Goodbye.</code></pre>

<p>The first few lines tell you the modules that Net::FTP uses and their versions, this is useful data to me when a user reports a bug. The last seven lines show the communication with the server. Each line has three parts. The first part is the object itself, this is useful for separating the output if you are using multiple objects. The second part is either <code>&lt;&lt;&lt;&lt;</code> to show data coming from the server or <code>&amp;gt&amp;gt&amp;gt&amp;gt</code> to show data going to the server. The remainder of the line is the command being sent or response being received.</p>

<h1 id="AUTHOR-AND-COPYRIGHT"><a class="permalink" href="./Net::libnetFAQ.html#AUTHOR-AND-COPYRIGHT">#</a><a id="AUTHOR"></a>AUTHOR AND COPYRIGHT</h1>

<p>Copyright (C) 1997-1998 Graham Barr. All rights reserved.</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
